Skip to content

fix: keep SSH known_hosts temp file alive until repository cleanup#150

Closed
creydr wants to merge 1 commit into
mainfrom
fix/known-hosts-tempfile-lifecycle
Closed

fix: keep SSH known_hosts temp file alive until repository cleanup#150
creydr wants to merge 1 commit into
mainfrom
fix/known-hosts-tempfile-lifecycle

Conversation

@creydr
Copy link
Copy Markdown
Collaborator

@creydr creydr commented May 20, 2026

Summary

  • The known_hosts temp file created in getSSHClientOptions was immediately deleted via defer before the SSH connection was established in CloneRepository, causing host key verification to silently fail
  • The temp file path is now tracked in Repository.knownHostFile and cleaned up by Cleanup()
  • A defer in CloneRepository ensures cleanup on error paths where no Repository is returned to the caller

The known_hosts temp file was deleted via defer in getSSHClientOptions,
which runs before the SSH connection is established in CloneRepository.
This caused host key verification to fail silently when known_hosts data
was provided.

Move temp file lifecycle management to Repository, which cleans up all
temp files in its Cleanup method alongside the cloned directory.
@creydr creydr closed this May 20, 2026
@creydr creydr deleted the fix/known-hosts-tempfile-lifecycle branch May 20, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant